﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace ReporterEngine
{
    public class AvailableModel : INotifyPropertyChanged
    {
        //TODO: otestovat, cije potrebna explicitna implementacia INotifyPropertyChanged interfacu.... ObservableCollection by mali same notifikovat zmeny
        private ObservableCollection<ModelProperty> _modelProperties;
        private ObservableCollection<ModelReference> _modelReferences;
        private ObservableCollection<ModelUsedBy> _modelUsedBys;
        private ObservableCollection<ModelType> _modelTypes;
        private ObservableCollection<ModelMethod> _modelMethods;
        private ObservableCollection<ModelStoredExpression> _modelStoredExpressions;

        public ObservableCollection<ModelProperty> ModelProperties
        {
            get { return _modelProperties; }
            set
            {
                _modelProperties = value;
                this.NotifyPropertyChanged("ModelProperties");
            }
        }

        public ObservableCollection<ModelReference> ModelReferences
        {
            get { return _modelReferences; }
            set
            {
                _modelReferences = value;
                this.NotifyPropertyChanged("ModelReferences");
            }
        }

        public ObservableCollection<ModelUsedBy> ModelUsedBys
        {
            get { return _modelUsedBys; }
            set
            {
                _modelUsedBys = value;
                this.NotifyPropertyChanged("ModelUsedBys");
            }
        }

        public ObservableCollection<ModelType> ModelTypes
        {
            get { return _modelTypes; }
            set
            {
                _modelTypes = value;
                this.NotifyPropertyChanged("ModelTypes");
            }
        }

        public ObservableCollection<ModelMethod> ModelMethods
        {
            get { return _modelMethods; }
            set
            {
                _modelMethods = value;
                this.NotifyPropertyChanged("ModelMethods");
            }
        }

        public ObservableCollection<ModelStoredExpression> ModelStoredExpressions
        {
            get { return _modelStoredExpressions; }
            set
            {
                _modelStoredExpressions = value;
                this.NotifyPropertyChanged("ModelStoredExpressions");
            }
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;


        protected void NotifyPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
